package edu.hubu.work01.controller;


import edu.hubu.work01.Service.CowService;
import edu.hubu.work01.entity.Cow;
import edu.hubu.work01.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class CowController {
    @Autowired

    private CowService cowService;

    @RequestMapping("/cow/add")
    public ResultVO add(Cow cow){
        return cowService.addCow(cow);
    }
    @RequestMapping("/cow/delete")

    public ResultVO delete(int cowId){
        return cowService.removeCow(cowId);

    }
    @RequestMapping("/cow/selects")
    public ResultVO selects(int cshdId){
        return cowService.selectCow(cshdId);
    }
    @RequestMapping("/cow/list")
    public ResultVO list(){
        return cowService.listCow();
    }
    @RequestMapping("/cow/remark")
    public ResultVO update(int cowId,String remark){
        return cowService.markCow(cowId,remark);
    }

}
